#include<iostream>
using namespace std;
const int N = 1100;
int n, m;
int w[N], v[N];
int f[N];
int main()
{
	cin >> n;
	m = n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < i; j++) {
			if (!(i % j)) {
				w[i] += j;
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		v[i] = i;
		for (int j = m; j >= v[i]; j--) {
			f[j] = max(f[j], f[j - v[i]] + w[i]);
		}
	}
	cout << f[m] << endl;
	return 0;
}